{
    "cells": [
        {
            "cell_type": "code",
            "execution_count": 1,
            "metadata": {},
            "outputs": [],
            "source": [
                "import pandas as pd,xlwings as xw,订单完成_函数 as dd\n"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 6,
            "metadata": {},
            "outputs": [],
            "source": [
                "\n",
                "# 用户填写内容\n",
                "file_path = r'D:\\\\桌面\\\\2024年10月跑男提现汇总表(5).xlsx'\n",
                "file_path2 = r'D:\\\\桌面\\\\部门.xlsx'\n",
                "file_path3 = r'D:\\\\桌面\\\\代理城市匹配.xlsx'\n",
                "user_sheet = '17'\n",
                "日期VAL='10.17'\n"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 1,
            "metadata": {},
            "outputs": [],
            "source": [
                "\n",
                "# 读取Excel文件\n",
                "wb = xw.Book(file_path)\n",
                "wb2 = xw.Book(file_path2)"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 7,
            "metadata": {},
            "outputs": [],
            "source": [
                "wb3 = xw.Book(file_path3)"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": null,
            "metadata": {},
            "outputs": [],
            "source": [
                "# 遍历所有工作表\n",
                "for sheet in wb.sheets:\n",
                "    print(f\"正在处理工作表: {sheet.name}\")\n",
                "    \n",
                "    # 先批量读取 M2 和 N2, V2 和 W2 的值\n",
                "    m2_value, n2_value = sheet.range('M2').value, sheet.range('N2').value\n",
                "    v2_value, w2_value = sheet.range('V2').value, sheet.range('W2').value\n",
                "    \n",
                "    # 检查L列后面是否已经存在\"部门编码\"和\"部门\"列\n",
                "    if not (m2_value == '部门编码' and n2_value == '部门'):\n",
                "        # 插入M列和N列，并将其格式设置为文本\n",
                "        sheet.range('M1:N1').api.EntireColumn.Insert()\n",
                "        sheet.range('M:M').api.NumberFormat = \"@\"\n",
                "        sheet.range('N:N').api.NumberFormat = \"@\"\n",
                "        # 添加表头\n",
                "        sheet.range('M2:N2').value = ['部门编码', '部门']\n",
                "    else:\n",
                "        print(f\"{sheet.name}: 第二个表已经添加过部门编码和部门列\")\n",
                "#匹配部门编码和部门\n",
                "    # 获取第二个表的有效行数（列P和列U）\n",
                "    df_pu = sheet.range('P3:U2000').value  # 批量读取P列和U列数据\n",
                "\n",
                "    # 过滤有效数据，遇到空行或“合计”行停止\n",
                "    valid_rows = [(i, row[0], row[5]) for i, row in enumerate(df_pu, start=3)\n",
                "                  if row[0] and row[5] and row[0] != '合计' and row[5] != '合计']\n",
                "\n",
                "    if valid_rows:\n",
                "        endLineNum = valid_rows[-1][0]  # 最后一行的行号\n",
                "        print(f\"有效行数: {endLineNum}\")\n",
                "\n",
                "        # 读取第二个Excel文件的数据（wb2: E列, F列, A列, B列）\n",
                "        df_wb2 = pd.DataFrame({\n",
                "            'F列': wb2.sheets[0].range('F1:F300').value,\n",
                "            'E列': wb2.sheets[0].range('E1:E300').value,\n",
                "            'A列': wb2.sheets[0].range('A1:A300').value,\n",
                "            'B列': wb2.sheets[0].range('B1:B300').value,\n",
                "        })\n",
                "\n",
                "        # 进行匹配并填充 M 和 N 列\n",
                "        for i, p_val, u_val in valid_rows:\n",
                "            match = df_wb2[(df_wb2['F列'] == p_val) & (df_wb2['E列'] == u_val)]\n",
                "            if not match.empty:\n",
                "                sheet.range(f'M{i}:N{i}').value = [match['A列'].values[0], match['B列'].values[0]]\n",
                "\n",
                "    # 检查V列后面是否已经存在\"往来单位编码\"和\"往来单位\"列\n",
                "    if not (v2_value == '往来单位编码' and w2_value == '往来单位'):\n",
                "        # 插入V列和W列，并将其格式设置为文本\n",
                "        sheet.range('V1:W1').api.EntireColumn.Insert()\n",
                "        sheet.range('V:V').api.NumberFormat = \"@\"\n",
                "        sheet.range('W:W').api.NumberFormat = \"@\"\n",
                "        # 添加表头\n",
                "        sheet.range('V2:W2').value = ['往来单位编码', '往来单位']\n",
                "    else:\n",
                "        print(f\"{sheet.name}: 第三个表已经添加过往来单位编码和往来单位列\")\n",
                "#匹配往来单位编码和往来单位   \n",
                "    # 获取 Y 列和 AD 列的有效行数\n",
                "    df_ya = sheet.range('Y3:AD2000').value  # 批量读取 Y 列和 AD 列数据\n",
                "\n",
                "    # 过滤有效数据，遇到空行或“合计”行停止\n",
                "    valid_rows_ya = [(i, row[0], row[5]) for i, row in enumerate(df_ya, start=3)\n",
                "                     if row[0] and row[5] and row[0] != '合计' and row[5] != '合计']\n",
                "\n",
                "    if valid_rows_ya:\n",
                "        endLineNum_ya = valid_rows_ya[-1][0]  # 最后一行的行号\n",
                "        print(f\"Y-AD 有效行数: {endLineNum_ya}\")\n",
                "\n",
                "       # 读取第三个Excel文件的数据（wb3: C列, D列, A列, B列）\n",
                "# 先读取各列\n",
                "c_col = wb3.sheets[0].range('C1:C600').value\n",
                "d_col = wb3.sheets[0].range('D1:D300').value\n",
                "a_col = wb3.sheets[0].range('A1:A600').value\n",
                "b_col = wb3.sheets[0].range('B1:B600').value\n",
                "\n",
                "# 确保所有列长度一致，使用 None 填充 D 列和 B 列，直到达到 600 行\n",
                "d_col.extend([None] * (600 - len(d_col)))  # D列补充空值到600行\n",
                "b_col.extend([None] * (600 - len(b_col)))  # B列补充空值到600行\n",
                "\n",
                "# 创建 DataFrame\n",
                "df_wb3 = pd.DataFrame({\n",
                "    'C列': c_col,\n",
                "    'D列': d_col,\n",
                "    'A列': a_col,\n",
                "    'B列': b_col,\n",
                "})\n",
                "\n",
                "# 后续匹配和填充的逻辑不变\n",
                "# 进行匹配并填充 V 和 W 列\n",
                "for i, y_val, ad_val in valid_rows_ya:\n",
                "    # 匹配 Y 列和 AD 列中的值与 wb3 中的 C 列和 D 列\n",
                "    match = df_wb3[(df_wb3['C列'] == y_val) & (df_wb3['D列'] == ad_val)]\n",
                "    if not match.empty:\n",
                "        # 将 A 列和 B 列数据填充到 V 和 W 列\n",
                "        sheet.range(f'V{i}:W{i}').value = [match['A列'].values[0], match['B列'].values[0]]\n",
                "    \n",
                "\n",
                "# 保存修改后的Excel文件\n",
                "# wb.save(file_path)\n"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 16,
            "metadata": {},
            "outputs": [
                {
                    "data": {
                        "text/html": [
                            "<div>\n",
                            "<style scoped>\n",
                            "    .dataframe tbody tr th:only-of-type {\n",
                            "        vertical-align: middle;\n",
                            "    }\n",
                            "\n",
                            "    .dataframe tbody tr th {\n",
                            "        vertical-align: top;\n",
                            "    }\n",
                            "\n",
                            "    .dataframe thead th {\n",
                            "        text-align: right;\n",
                            "    }\n",
                            "</style>\n",
                            "<table border=\"1\" class=\"dataframe\">\n",
                            "  <thead>\n",
                            "    <tr style=\"text-align: right;\">\n",
                            "      <th></th>\n",
                            "      <th>C列</th>\n",
                            "      <th>D列</th>\n",
                            "      <th>A列</th>\n",
                            "      <th>B列</th>\n",
                            "    </tr>\n",
                            "  </thead>\n",
                            "  <tbody>\n",
                            "    <tr>\n",
                            "      <th>0</th>\n",
                            "      <td>城市</td>\n",
                            "      <td>业务类型</td>\n",
                            "      <td>往来单位编码</td>\n",
                            "      <td>往来单位</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>1</th>\n",
                            "      <td>文山市</td>\n",
                            "      <td>跑腿</td>\n",
                            "      <td>J010072</td>\n",
                            "      <td>文山代理商</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>2</th>\n",
                            "      <td>霸州市</td>\n",
                            "      <td>跑腿</td>\n",
                            "      <td>J010229</td>\n",
                            "      <td>霸州代理商</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>3</th>\n",
                            "      <td>敦煌市</td>\n",
                            "      <td>跑腿</td>\n",
                            "      <td>J010224</td>\n",
                            "      <td>敦煌代理商</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>4</th>\n",
                            "      <td>涡阳县</td>\n",
                            "      <td>跑腿</td>\n",
                            "      <td>J010324</td>\n",
                            "      <td>涡阳县代理商</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>...</th>\n",
                            "      <td>...</td>\n",
                            "      <td>...</td>\n",
                            "      <td>...</td>\n",
                            "      <td>...</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>595</th>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>596</th>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>597</th>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>598</th>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "    </tr>\n",
                            "    <tr>\n",
                            "      <th>599</th>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "      <td>None</td>\n",
                            "    </tr>\n",
                            "  </tbody>\n",
                            "</table>\n",
                            "<p>600 rows × 4 columns</p>\n",
                            "</div>"
                        ],
                        "text/plain": [
                            "       C列    D列       A列      B列\n",
                            "0      城市  业务类型   往来单位编码    往来单位\n",
                            "1     文山市    跑腿  J010072   文山代理商\n",
                            "2     霸州市    跑腿  J010229   霸州代理商\n",
                            "3     敦煌市    跑腿  J010224   敦煌代理商\n",
                            "4     涡阳县    跑腿  J010324  涡阳县代理商\n",
                            "..    ...   ...      ...     ...\n",
                            "595  None  None     None    None\n",
                            "596  None  None     None    None\n",
                            "597  None  None     None    None\n",
                            "598  None  None     None    None\n",
                            "599  None  None     None    None\n",
                            "\n",
                            "[600 rows x 4 columns]"
                        ]
                    },
                    "execution_count": 16,
                    "metadata": {},
                    "output_type": "execute_result"
                }
            ],
            "source": [
                "df_wb3"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 18,
            "metadata": {},
            "outputs": [
                {
                    "data": {
                        "text/plain": [
                            "'社旗县'"
                        ]
                    },
                    "execution_count": 18,
                    "metadata": {},
                    "output_type": "execute_result"
                }
            ],
            "source": [
                "y_val"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": null,
            "metadata": {},
            "outputs": [],
            "source": [
                "#匹配往来单位编码和往来单位\n",
                "    # 获取第二个表的有效行数（列P和列U）\n",
                "    df_pu = sheet.range('P3:U2000').value  # 批量读取P列和U列数据\n",
                "\n",
                "    # 过滤有效数据，遇到空行或“合计”行停止\n",
                "    valid_rows = [(i, row[0], row[5]) for i, row in enumerate(df_pu, start=3)\n",
                "                  if row[0] and row[5] and row[0] != '合计' and row[5] != '合计']\n",
                "\n",
                "    if valid_rows:\n",
                "        endLineNum = valid_rows[-1][0]  # 最后一行的行号\n",
                "        print(f\"有效行数: {endLineNum}\")\n",
                "\n",
                "        # 读取第二个Excel文件的数据（wb2: E列, F列, A列, B列）\n",
                "        df_wb2 = pd.DataFrame({\n",
                "            'F列': wb2.sheets[0].range('F1:F300').value,\n",
                "            'E列': wb2.sheets[0].range('E1:E300').value,\n",
                "            'A列': wb2.sheets[0].range('A1:A300').value,\n",
                "            'B列': wb2.sheets[0].range('B1:B300').value,\n",
                "        })\n",
                "\n",
                "        # 进行匹配并填充 M 和 N 列\n",
                "        for i, p_val, u_val in valid_rows:\n",
                "            match = df_wb2[(df_wb2['F列'] == p_val) & (df_wb2['E列'] == u_val)]\n",
                "            if not match.empty:\n",
                "                sheet.range(f'M{i}:N{i}').value = [match['A列'].values[0], match['B列'].values[0]]\n",
                "\n",
                "    # 检查V列后面是否已经存在\"往来单位编码\"和\"往来单位\"列\n",
                "    if not (v2_value == '往来单位编码' and w2_value == '往来单位'):\n",
                "        # 插入V列和W列，并将其格式设置为文本\n",
                "        sheet.range('V1:W1').api.EntireColumn.Insert()\n",
                "        sheet.range('V:V').api.NumberFormat = \"@\"\n",
                "        sheet.range('W:W').api.NumberFormat = \"@\"\n",
                "        # 添加表头\n",
                "        sheet.range('V2:W2').value = ['往来单位编码', '往来单位']\n",
                "    else:\n",
                "        print(f\"{sheet.name}: 第三个表已经添加过往来单位编码和往来单位列\")\n",
                "\n",
                "# 保存修改后的Excel文件\n",
                "# wb.save(file_path)\n"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 9,
            "metadata": {},
            "outputs": [
                {
                    "ename": "IndentationError",
                    "evalue": "unexpected indent (1743224936.py, line 3)",
                    "output_type": "error",
                    "traceback": [
                        "\u001b[1;36m  Cell \u001b[1;32mIn[9], line 3\u001b[1;36m\u001b[0m\n\u001b[1;33m    df2_pu = sheet.range('Y3:AD2000').value  # 批量读取P列和U列数据\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mIndentationError\u001b[0m\u001b[1;31m:\u001b[0m unexpected indent\n"
                    ]
                }
            ],
            "source": [
                "#匹配往来单位编码和往来单位\n",
                "    # 获取第二个表的有效行数（列P和列U）\n",
                "    df2_pu = sheet.range('Y3:AD2000').value  # 批量读取P列和U列数据\n",
                "\n",
                "    # 过滤有效数据，遇到空行或“合计”行停止\n",
                "    valid_rows = [(i, row[0], row[5]) for i, row in enumerate(df_pu, start=3)\n",
                "                  if row[0] and row[5] and row[0] != '合计' and row[5] != '合计']\n",
                "\n",
                "    if valid_rows:\n",
                "        endLineNum = valid_rows[-1][0]  # 最后一行的行号\n",
                "        print(f\"有效行数: {endLineNum}\")\n",
                "\n",
                "        # 读取第三个Excel文件的数据（wb2: E列, F列, A列, B列）\n",
                "        df_wb3 = pd.DataFrame({\n",
                "            'C列': wb2.sheets[0].range('F1:F600').value,\n",
                "            'D列': wb2.sheets[0].range('E1:E600').value,\n",
                "            'A列': wb2.sheets[0].range('A1:A600').value,\n",
                "            'B列': wb2.sheets[0].range('B1:B600').value,\n",
                "        })\n",
                "\n",
                "        # 进行匹配并填充 M 和 N 列\n",
                "        for i, p_val, u_val in valid_rows:\n",
                "            match = df_wb2[(df_wb2['Y列'] == p_val) & (df_wb2['AD列'] == u_val)]\n",
                "            if not match.empty:\n",
                "                sheet.range(f'M{i}:N{i}').value = [match['V列'].values[0], match['W列'].values[0]]"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": null,
            "metadata": {},
            "outputs": [],
            "source": [
                "\n",
                "# 获取所有的 sheet 名称\n",
                "all_sheets = [sheet.name for sheet in wb.sheets]\n",
                "\n",
                "# 检查 user_sheet 是否存在\n",
                "if user_sheet in all_sheets:\n",
                "    print(f\"Sheet '{user_sheet}' 存在.\")\n",
                "    sheet = wb.sheets[user_sheet]\n",
                "    \n",
                "else:\n",
                "    print(f\"Sheet '{user_sheet}' 不存在，请检查工作表名称.\")\n",
                "\n",
                "\n",
                "sheet = wb.sheets[user_sheet]\n",
                "\n",
                "# 获取第一个表（B-L列）的有效行数\n",
                "# 一次性读取B-L列的数据\n",
                "df1 = sheet.range('B2:L2000').options(pd.DataFrame, header=1, index=False).value\n",
                "\n",
                "# 过滤有效数据，遇到空行或“合计”行停止\n",
                "valid_rows1 = df1[df1['系统城市名称'].notna() & (df1['系统城市名称'] != '合计')]\n",
                "\n",
                "# 获取第一个表的实际有效行号\n",
                "endLineNum1 = valid_rows1.index[-1] + 3  # 因为从B2开始，Excel行号需要加3\n",
                "\n",
                "# 打印第一个表的有效行数\n",
                "print(f\"第一个表有效行数: {endLineNum1}\")\n",
                "\n",
                "\n",
                "# 获取第二个表（Q-V列）的有效行数\n",
                "# 一次性读取Q-V列的数据\n",
                "df2 = sheet.range('M2:U2000').options(pd.DataFrame, header=1, index=False).value\n",
                "\n",
                "# 过滤有效数据，遇到空行或“合计”行停止\n",
                "valid_rows2 = df2[df2['系统城市名称'].notna() & (df2['系统城市名称'] != '合计')]\n",
                "\n",
                "# 获取第二个表的实际有效行号\n",
                "endLineNum2 = valid_rows2.index[-1] + 3  # 因为从Q2开始，Excel行号需要加2\n",
                "\n",
                "# 打印第二个表的有效行数\n",
                "print(f\"第二个表有效行数: {endLineNum2}\")\n",
                "\n",
                "# 获取第三个表（AA-AF列）的有效行数\n",
                "# 一次性读取AA-AF列的数据\n",
                "df3 = sheet.range('V2:AD2000').options(pd.DataFrame, header=1, index=False).value\n",
                "\n",
                "# 过滤有效数据，遇到空行或“合计”行停止\n",
                "valid_rows3 = df3[df3['系统城市名称'].notna() & (df3['系统城市名称'] != '合计')]\n",
                "\n",
                "# 获取第三个表的实际有效行号\n",
                "endLineNum3 = valid_rows3.index[-1] + 3  # 因为从Q2开始，Excel行号需要加2\n",
                "\n",
                "# 打印第三个表的有效行数\n",
                "print(f\"第三个表有效行数: {endLineNum3}\")"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 6,
            "metadata": {},
            "outputs": [],
            "source": [
                "# 根据endLineNum1动态获取数据范围\n",
                "df1 = sheet.range(f'B2:L{endLineNum1}').options(pd.DataFrame).value.reset_index()\n",
                "\n",
                "# 从第二行开始获取数据（因为表头合并）\n",
                "df1 = df1.iloc[0:]\n",
                "\n",
                "# 打印查看数据\n",
                "# print(df1)\n",
                "# print(df1.head())\n"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 7,
            "metadata": {},
            "outputs": [],
            "source": [
                "# 根据endLineNum1动态获取数据范围\n",
                "df2 = sheet.range(f'M2:U{endLineNum2}').options(pd.DataFrame).value.reset_index()\n",
                "\n",
                "# 从第二行开始获取数据（因为表头合并）\n",
                "df2 = df2.iloc[0:]\n",
                "\n",
                "# 打印查看数据\n",
                "# print(df1)\n",
                "# print(df1.head())\n"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 8,
            "metadata": {},
            "outputs": [],
            "source": [
                "# 根据endLineNum1动态获取数据范围\n",
                "df3 = sheet.range(f'V2:AD{endLineNum3}').options(pd.DataFrame).value.reset_index()\n",
                "\n",
                "# 从第二行开始获取数据（因为表头合并）\n",
                "df3 = df3.iloc[0:]\n",
                "\n",
                "# 打印查看数据\n",
                "# print(df1)\n",
                "# print(df1.head())\n"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 9,
            "metadata": {},
            "outputs": [],
            "source": [
                "if (df3['业务类型'] == \"跑腿\").any():\n",
                "    科目 = \"跑腿代理商跑男\"\n",
                "    科目编码VAL = '123456'\n",
                "\n",
                "elif (df3['业务类型'] == \"家政\").any():\n",
                "    科目 = \"家政代理商跑男\"\n",
                "    科目编码VAL = '1234567'\n",
                "\n",
                "elif (df3['业务类型'] == \"货运\").any():\n",
                "    科目 = \"货运代理商跑男\"\n",
                "    科目编码VAL = '1234568'\n",
                "\n",
                "elif (df3['业务类型'] == \"代驾\").any():\n",
                "    科目 = \"代驾代理商跑男\"\n",
                "    科目编码VAL = '1234569'\n"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 18,
            "metadata": {},
            "outputs": [],
            "source": [
                "直营跑男提现=dd.通用凭证模版(dd.clm,'应付凭证',摘要=日期VAL+'支付'+df2['业务类型']+df2['系统城市名称']+'跑男提现',科目编码='110224',借贷方向='借方',本币=df2['后台成功'],\n",
                "               部门编码=df2['部门编码'],部门=df2['部门'])   "
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 11,
            "metadata": {},
            "outputs": [],
            "source": [
                "代理跑男提现=dd.通用凭证模版(dd.clm,'应付凭证',摘要=日期VAL+'支付'+df3['业务类型']+df3['系统城市名称']+'跑男提现',科目编码=科目编码VAL,借贷方向='借方',本币=df3['后台成功'],\n",
                "               往来单位编码=df3['往来单位编码'],往来单位=df3['往来单位']) "
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 12,
            "metadata": {},
            "outputs": [],
            "source": [
                "\n",
                "中信支付=dd.通用凭证模版(dd.clm,'应付凭证',摘要=日期VAL+'支付跑男提现',科目编码='100215',借贷方向='贷方',本币=[df1['中信支付'].sum()])\n",
                "\n",
                "中信支付退回=dd.通用凭证模版(dd.clm,'应付凭证',摘要=日期VAL+'支付跑男提现 退回',科目编码='100215',借贷方向='贷方',本币=[df1['中信退回'].sum()])\n",
                "\n",
                "浙商支付=dd.通用凭证模版(dd.clm,'应付凭证',摘要=日期VAL+'支付跑男提现',科目编码='100221',借贷方向='贷方',本币=[df1['浙商支付'].sum()])\n",
                "\n",
                "浙商支付退回=dd.通用凭证模版(dd.clm,'应付凭证',摘要=日期VAL+'支付跑男提现退回',科目编码='100221',借贷方向='贷方',本币=[df1['浙商退回'].sum()])"
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 13,
            "metadata": {},
            "outputs": [],
            "source": [
                "凭证=pd.concat([直营跑男提现,代理跑男提现,中信支付,中信支付退回,浙商支付,浙商支付退回]) "
            ]
        },
        {
            "cell_type": "code",
            "execution_count": 14,
            "metadata": {},
            "outputs": [],
            "source": [
                "凭证.to_clipboard()"
            ]
        }
    ],
    "metadata": {
        "kernelspec": {
            "display_name": "Python 3",
            "language": "python",
            "name": "python3"
        },
        "language_info": {
            "codemirror_mode": {
                "name": "ipython",
                "version": 3
            },
            "file_extension": ".py",
            "mimetype": "text/x-python",
            "name": "python",
            "nbconvert_exporter": "python",
            "pygments_lexer": "ipython3",
            "version": "3.12.5"
        }
    },
    "nbformat": 4,
    "nbformat_minor": 2
}
